package com.zcxy.web.controller.edu;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zcxy.common.annotation.Log;
import com.zcxy.common.core.controller.BaseController;
import com.zcxy.common.core.domain.AjaxResult;
import com.zcxy.common.enums.BusinessType;
import com.zcxy.edu.domain.EduAllSmsUser;
import com.zcxy.edu.service.IEduAllSmsUserService;
import com.zcxy.common.utils.poi.ExcelUtil;
import com.zcxy.common.core.page.TableDataInfo;

/**
 * 发送短信配置用户Controller
 *
 * @author ruoyi
 * @date 2024-11-03
 */
@RestController
@RequestMapping("/edu/allSmsUser")
public class EduAllSmsUserController extends BaseController
{
    @Autowired
    private IEduAllSmsUserService eduAllSmsUserService;

    /**
     * 查询发送短信配置用户列表
     */
    @PreAuthorize("@ss.hasPermi('edu:allSmsEdu:list')")
    @GetMapping("/list")
    public TableDataInfo list(EduAllSmsUser eduAllSmsUser)
    {
        startPage();
        List<EduAllSmsUser> list = eduAllSmsUserService.selectEduAllSmsUserList(eduAllSmsUser);
        return getDataTable(list);
    }

    /**
     * 导出发送短信配置用户列表
     */
    @PreAuthorize("@ss.hasPermi('edu:allSmsEdu:export')")
    @Log(title = "发送短信配置用户", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, EduAllSmsUser eduAllSmsUser)
    {
        List<EduAllSmsUser> list = eduAllSmsUserService.selectEduAllSmsUserList(eduAllSmsUser);
        ExcelUtil<EduAllSmsUser> util = new ExcelUtil<EduAllSmsUser>(EduAllSmsUser.class);
        util.exportExcel(response, list, "发送短信配置用户数据");
    }

    /**
     * 获取发送短信配置用户详细信息
     */
    @PreAuthorize("@ss.hasPermi('edu:allSmsEdu:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(eduAllSmsUserService.selectEduAllSmsUserById(id));
    }

    /**
     * 新增发送短信配置用户
     */
    @PreAuthorize("@ss.hasPermi('edu:allSmsEdu:add')")
    @Log(title = "发送短信配置用户", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody EduAllSmsUser eduAllSmsUser)
    {
        return toAjax(eduAllSmsUserService.insertEduAllSmsUser(eduAllSmsUser));
    }

    /**
     * 修改发送短信配置用户
     */
    @PreAuthorize("@ss.hasPermi('edu:allSmsEdu:edit')")
    @Log(title = "发送短信配置用户", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody EduAllSmsUser eduAllSmsUser)
    {
        return toAjax(eduAllSmsUserService.updateEduAllSmsUser(eduAllSmsUser));
    }

    /**
     * 删除发送短信配置用户
     */
    @PreAuthorize("@ss.hasPermi('edu:allSmsEdu:remove')")
    @Log(title = "发送短信配置用户", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(eduAllSmsUserService.deleteEduAllSmsUserByIds(ids));
    }
}
